<template>
	<view>
		<view class="bg-white success-msg">
			<view class="msg-view">
				<view class=" padding flex align-center">
					<view class="flex-sub text-center">
						<view class="text-xsl">
							<text class="cuIcon-roundcheckfill text-blue"></text>
						</view>
						<view class=" text-msg">支付成功</view>
					</view>
				</view>
			</view>

			<view class="padding flex flex-direction margin-top">
				<button class="cu-btn line-blue lg" @click="_toOrderPage()">查看订单</button>
			</view>
			<view class="padding-lr flex flex-direction" v-if="oweAmount>0">
				<button class="cu-btn bg-red lg" @click="_toOwnerOweFeePage()">物业欠费{{oweAmount}}元，去缴费</button>
			</view>
			<view class="padding-lr flex flex-direction" v-else>
				<button class="cu-btn line-gray lg" >未查询到物业欠费</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {queryUserPropertyFee} from '@/api/user/userApi.js';
	export default {
		data() {
			return {
				msg: '',
				cashierUserId:'',
				oweAmount:0
			}
		},
		onLoad(options) {
			this.cashierUserId = options.cashierUserId;
			this.getUserPropertyFee();
		},
		methods: {
			_indexPage:function(){
				uni.switchTab({
					url: "/pages/index/index?wAppId=" + this.vc.getWAppId()
				});
			},
			getUserPropertyFee:function(){
				let _that = this;
				queryUserPropertyFee({
					page:1,
					row:50
				}).then(_data=>{
					_that.oweAmount = _data.data.oweMoney;
				},err=>{
					console.error(err);
				})
			},
			_toOrderPage:function() {
				let _orderUrl = uni.getStorageSync('cashierSuccessUrl');
				if(_orderUrl) {
					uni.navigateTo({
						url:_orderUrl
					});
				}
				else {
					uni.switchTab({
						url: "/pages/order/order"
					})
				}
			},
			_toOwnerOweFeePage:function(){
				uni.navigateTo({
					url:"/pages/order/ownerOweFee"
				});
			}
		}
	}
</script>

<style lang="scss">
	.success-msg {
		padding-top: 100upx;
		padding-bottom: 50upx;
		height: 100vh;
		.msg-view{
			height: 400upx;
		}
	}

	.text-xsl {
		font-size: 180upx;
		line-height: 1.2;
	}

	.text-msg {
		font-size: 40upx;
	}

	.home_wrap {
		padding: 20upx 20upx 0;
	}
</style>
